package cn.glutnn.service.impl;

import cn.glutnn.mapper.ReserveMapper;
import cn.glutnn.service.ReserveService;
import cn.glutnn.utils.ThreadLocalUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import cn.glutnn.entity.Reserve;

import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * (Reserve)表服务实现类
 *
 * @author msh
 * @since 2024-10-25 09:36:26
 */
@Service
public class ReserveServiceImpl extends ServiceImpl<ReserveMapper, Reserve> implements ReserveService {

    @Override
    public List<Reserve> selectByKind(String kind) {
        Map<String, Object> threadLocal = ThreadLocalUtil.get();
        String username=(String) threadLocal.get("username");
        QueryWrapper<Reserve> queryWrapper = new QueryWrapper<>();
        if ("questioner".equals(kind)){
            queryWrapper.eq("questioner", username);
        }else{
            queryWrapper.eq("questioner", username);
        }
        return list(queryWrapper);
    }
}

